#ifndef RELOCATION_SLAM_PCL_VIEWER_H
#define RELOCATION_SLAM_PCL_VIEWER_H

#include <iostream> //标准输入输出流
#include "pcl-1.7/pcl/point_types.h"
#include "pcl-1.7/pcl/visualization/cloud_viewer.h"
#include "MapPoints.h"


void viewerOneOff (pcl::visualization::PCLVisualizer& viewer,Eigen::Isometry3d p) {
	//设置背景颜色
//	viewer.setBackgroundColor(1.0, 0.5, 1.0);
	//球体坐标
	pcl::PointXYZ o;
	o.x = 0;
	o.y = 0;
	o.z = 0;
	//添加球体
	viewer.addSphere(o, 0.1, "sphere", 0);
	std::cout << "i only run once" << std::endl;
}

void pclShow(vector<Relocation_Slam::MapPoint> MapPoints)
{
	pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>); // 创建点云（指针）

	cloud->width = MapPoints.size ();
	cloud->height = 1;
	cloud->is_dense = true;
	for(int i=0;i<MapPoints.size();i++){
		pcl::PointXYZ p(MapPoints[i].mPose[0],MapPoints[i].mPose[1],MapPoints[i].mPose[2]);
		cloud->points.push_back(p);
	}

	pcl::visualization::CloudViewer viewer("pcd viewer");

	viewer.showCloud(cloud);
	sleep(30);

}
#endif //RELOCATION_SLAM_PCL_VIEWER_H
